//
//  OwnerAccountTableViewController.m
//  GoodWayClient
//
//  Created by newhuidong on 15/12/26.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "OwnerAccountTableViewController.h"
#import "Tool.h"
#import "AFNetworking.h"
#import "AppDelegate.h"
#import "Constant.h"
#import "userInfo.h"
@interface OwnerAccountTableViewController ()
@property (weak, nonatomic) IBOutlet UILabel *Account;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *phone;
@property (weak, nonatomic) IBOutlet UILabel *Email;
@property (weak, nonatomic) IBOutlet UILabel *weixin;

@end

@implementation OwnerAccountTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"账户信息";
    

}

-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
    
    AFHTTPRequestOperationManager * manager =[AFHTTPRequestOperationManager manager];
    manager.responseSerializer=[AFJSONResponseSerializer serializer];
    NSMutableDictionary * dic=[NSMutableDictionary dictionary];
    AppDelegate*tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
    dic[@"token"]=tempAppDelegate.token;
    
    [manager POST:[NSString stringWithFormat:@"%@%@",url2,@"GetMyInfo"] parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic =(NSDictionary*)responseObject;
        
       if ([[NSString stringWithFormat:@"%@",dic[@"Status"]]isEqualToString:@"0"]) {
           
        NSDictionary *dic1 = dic [@"Data"];
        
                    NSLog(@"---------%@",dic1);
           userInfo * user = [[userInfo alloc]initWithDic:dic1];
           self.Account.text=[NSString stringWithFormat:@"%@",user.UserName];
           self.phone.text=[NSString stringWithFormat:@"%@",user.PhoneNum];
           self.name.text=[NSString stringWithFormat:@"%@",user.NickName];
           self.weixin.text=[NSString stringWithFormat:@"%@",user.Address];
           
                }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"失败");
    }];

}
@end
